package com.cloud.code.牛客网;

import java.util.Scanner;

public class Test62 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            int n = scanner.nextInt();
            int [] nums = new int[n];
            for (int i = 0; i < n; i++) {
                nums[i]  = scanner.nextInt();
            }
            int m = scanner.nextInt();


            int max = Integer.MIN_VALUE;
            for (int i = 0; i < n-m; i++) {
                int tem = 0;
                for (int j = i; j < i+m; j++) {
                    tem = tem+nums[j];
                }
                max = Math.max(max,tem);
            }

            System.out.println(max);
        }
    }
}
